#ifndef C3POM_PORTAL_MANAGER_H
#define C3POM_PORTAL_MANAGER_H
#include<string>
#include<map>
#include<omp.h>
#include"service.h"
#include"command.h"
#include"portal.h"
#include"plugin.h"
#include"log.h"
namespace c3pom
{
	class PortalMonitor
	{
		private:
			Portal* portal;//portal实体
			std::string owner;//属主插件
			std::string statu;//状态
			std::string pbuf;//使用的portalbuf的名称
			std::string datatype;
			omp_lock_t lock;
		private:
			friend class PortalManager;
			PortalMonitor();
	};
	class PortalManager:public Service
	{  
		private:
			Log* log;
			omp_lock_t lock;
			std::map<std::string,PortalMonitor*> portals;
			friend class Lspt;
			class Lspt:public Command
			{
			public:
				std::string name();
				std::string desc();
				int exec(std::vector<std::string>);
			};
		public:
			static PortalManager* getInstance();
			PortalManager();
			Portal* regPortal(std::string portalname,std::string portalbuf,std::string owner,std::string datatype);//注册portal
			Portal* findPortal(std::string portalname);//查找portal
			//服务相关
			std::string name();
			std::string desc();
			void run();
	};
}
#endif
